﻿@model Atacadao.Web.ModelView.PessoaPesquisa

@{
    ViewBag.Title = "ListaPessoas";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@using(Ajax.BeginForm("Pesquisa", new AjaxOptions() { HttpMethod = "Post", UpdateTargetId = "dvListPessoa", InsertionMode=InsertionMode.Replace})){
<h2>ListaPessoas</h2>
<div>
    <fieldset>
        <legend>Pessoa</legend>
        <div class="editor-label">
            @Html.LabelFor(model => model.Nome)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Nome)
            @Html.ValidationMessageFor(model => model.Nome)
        </div>
         <div class="editor-label">
            @Html.LabelFor(model => model.CPF)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.CPF)
            @Html.ValidationMessageFor(model => model.CPF)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.Login)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Login)
            @Html.ValidationMessageFor(model => model.Login)
        </div>
    </fieldset>
    <input type="submit" value="Pesquisar" />
</div>
}

<div id="dvListPessoa">
    @Html.Partial("ListaParcial", (IEnumerable<Atacadao.DB.Pessoa>)this.ViewBag.Lista)
</div>